All Functions Used So Far, Week 8

c

{base}

Combine values/vectors into a vector

factor

{base}

Create a factor

expression

{base}

Used in plots to add symbols to axes

quantile

{stats}

Obtain empirical quantiles of a vector

install.packages

{base}

Install R package

which.max

{base}

return index of the largest value in a vector

geom_segment

{GGPLOT2}

Generates a line segment or curve

data.frame

{base}

Create a data.frame from vectors

desc

{dplyr}

Arrange in descending order

geom_ribbon

{GGPLOT2}

Generates an area plot

sd

{stats}

Get standard deviation of a vector

ordered

{dplyr}

Create an ordered factor

dnorm

{stats}

Density distribution for the normal distribution

recode

{dplyr}

Recode a variable

cut

{base}

Convert Numeric to Factor

colnames

{base}

Retrieve column names of a data frame

select

{dplyr}

Select columns from a tibble/data frame

mutate

{dplyr}

Modify/create a column in a data frame

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

library

{base}

Load an R package

plot

{graphics}

Generic function from base R to produce a plot

read_dta

{haven}

Read a .dta file (Stata data)

levels

{base}

Get levels of a factor

element_line

{GGPLOT2}

Customise line appearance

boxplot

{graphics}

Plot a simple box plot

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

element_blank

{GGPLOT2}

This theme element draws nothing, and assigns no space

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

n

{dplyr}

The number of observations in the current group.

head

{utils}

Show first 5 rows of a data frame

geom_histogram

{GGPLOT2}

Generates a histogram

sum

{base}

Get sum of numeric values or a vector

print

{base}

Print object to the console

seq

{base}

Create a sequence

str

{utils}

Get the structure of an R object

min

{base}

Get minimum of a vector

as.character

{base}

Coerce a vector to character

theme

{GGPLOT2}

Set theme for GGPLOT2

with

{base}

evaluate expression in the context of a data frame

rm

{base}

Remove objects

hist

{graphics}

Plot a simple histogram

slice

{dplyr}

Subset rows using their positions

ggplot

{GGPLOT2}

Create a ggplot graph

View

{base}

View a data frame

var

{stats}

Calculate variance

max

{base}

Get maximum of a vector

element_text

{GGPLOT2}

Customise text in GGPLOT2

ggsave

{ggplot2}

Saves the last ggplot or a specified ggplot object to a file

par

{graphics}

Set parameters of the plotting device

ungroup

{dplyr}

Resolve grouping created with “group_by”

labs

{GGPLOT2}

Customise labels in GGPLOT2

median

{stats}

Get median of a vector

summary

{base}

Obtain summary statistics or detailed regression output

range

{base}

Return range of values

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

read_excel

{readxl}

Read an Excel file

ifelse

{base}

Return a or b depending on the value of test

as.numeric

{base}

Coerce a vector to numeric

mean

{base}

Get mean of a vector

separate

{dplyr}

Separate a character column into multiple columns

save

{base}

Writes an external representation of R objects to the specified file.

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

is.na

{base}

Check if a value is NA/elements of vector are NA

spread

{tidyr}

Spread a key-value pair across multiple columns

setwd

{base}

Set Working Directory

nrow

{base}

Get number of rows of a data frame

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

length

{base}

Returns number of elements in an object

filter

{dplyr}

Filter out rows of a data frame according to logical vector

names

{base}

Retrieve names of a list/vector

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

scale_y_continuous

{GGPLOT2}

Customise continuous y axis

geom_density

{GGPLOT2}

Generates a density plot

write.csv

{utils}

write a csv file to a data frame

The end!